//
//  OrderTraceListVC.m
//  NtoccShipper
//
//  Created by mac on 2019/12/26.
//  Copyright © 2019 zhuchongjin. All rights reserved.
//

#import "OrderTraceListVC.h"
#import "OrderTraceListCell.h"

@interface OrderTraceListVC ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) OrderTraceListCell *orderTraceListCell;
@property (nonatomic,strong) CJTableView *tableView;
@end

@implementation OrderTraceListVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self setTitleName:@"运单轨迹"];
    [self setBackLeftButton:@""];
    self.orderTraceListCell = [[OrderTraceListCell alloc]initWithFlex:nil reuseIdentifier:nil];
    [self.view addSubview:self.tableView];
//    WS(ws);
    self.tableView.placeHolderView = [[KKTableViewNoDataView alloc] initWithFrame:self.tableView.bounds image:[UIImage imageNamed:@"no_data"] viewClick:^{
    }];

    if (self.modelArray.count > 0) {
        [self.tableView reloadData];
    }
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:YES];
//    [self.tableView.mj_header beginRefreshing];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.modelArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *identifier = @"OrderTraceListCell";
    OrderTraceListCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[OrderTraceListCell alloc] initWithFlex:nil reuseIdentifier:identifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }

    NSDictionary *dic = self.modelArray[indexPath.row];
    BOOL isDefault = NO;
    if (indexPath.row == 0) {
        isDefault = YES;
    }
    [cell setCellInfoWithDic:dic isDefault:isDefault];
    return cell;
}

- (CJTableView *)tableView{
    if (!_tableView) {
        _tableView = CJTableView.tbInitFrameStyle(CGRectMake(0, CJTableToTopHeight + kTopHeight, SCREEN_WIDTH, SCREEN_HEIGHT-kTopHeight  -CJTableToTopHeight ),UITableViewStylePlain)
        .tbDelegate(self)
        .tbDataSource(self)
        .tbSetOther(YES)
        .tbEstimatedRowHeight(YES)
        ;
    }
    return _tableView;
}

@end
